package D240514.Practice01;

public class Student extends MyComparable {
    String name;
    char firstLetter;
    int score;
    int number01;
    double number02;
    String number03;

    public Student(String name, char firstLetter, int score, int number01, double number02) {
        super(firstLetter);
        this.name = name;
        this.firstLetter = firstLetter;
        this.score = score;
        this.number01 = number01;
        this.number02 = number02;
    }

    @Override
    public String toString() {
        return this.name + "(" + this.score + ")";
    }

    @Override
    public int compareTo(MyComparable myComparable) {
        if (myComparable instanceof Student other) {
            if (this.sortArgNumber == other.sortArgNumber) {
                return 0;
            } else if (this.sortArgNumber > other.sortArgNumber) {
                return 1;
            } else if (this.sortArgNumber < other.sortArgNumber) {
                return -1;
            }
        }
        System.out.println("类型不匹配");
        return -999;

    }
}
